package asteroids.model;

import exception.IllegalRadiusException;
import be.kuleuven.cs.som.annotate.*;

public class Bullet extends SpaceObject {

	public Bullet(double x, double y, double xVelocity, double yVelocity,
			double radius, Ship shipsSource) throws IllegalRadiusException,
			IllegalArgumentException {
		super(x, y, xVelocity, yVelocity, radius, SpaceObject.calculateMass(radius,Bullet.getMassDensity()));
		this.shipsSource = shipsSource;
	}

	@Basic
	private static double getMassDensity() {
		return massDensity;
	}
	
	private static final double massDensity = 7.8*Math.pow(10,12);
	
	@Basic
	public Ship getShipsSource(){
		return this.shipsSource;
	}
	
	private final Ship shipsSource;
	
	public void updateBoundryCounter(){
		if(isValidNextBoundryCounter(getBoundryCounter() +1))
			boundryCounter++;
		else
			terminate();
	}
	
	public boolean isValidNextBoundryCounter(double counter){
		return counter < 2 && counter > 0;
	}
	
	@Basic
	public double getBoundryCounter(){
		return boundryCounter;
	}
	
	private double boundryCounter =0;
	
	

}
